<!DOCTYPE html>
<html lang="cn">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="shortcut icon" href="assets/img/favicon.ico">

  <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
  <meta content="yes" name="apple-mobile-web-app-capable">
  <meta content="black" name="apple-mobile-web-app-status-bar-style">
  <meta content="telephone=no" name="format-detection">
  <meta content="email=no" name="format-detection">

  <title>
    <?echo $conf['web_name'] . "-" . $conf['web_title']; ?>
  </title>
  <meta name="keywords" content="<?echo $conf['web_keywords']; ?>">
  <meta name="description" content="<?echo $conf['web_description']; ?>">

  <link href="<?php echo $cdnpublic ?>twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
  <link href="<?php echo $cdnpublic ?>font-awesome/5.14.0/css/all.min.css" rel="stylesheet">

  <link href="<?php echo $cdnprivate ?><?php echo 'template/' . $template->loaddir() ?>/assets/css/style.css"
    rel="stylesheet">
  <style>
    body {
      padding-top: 0;
    }

    .clogin-header {
      position: unset;
    }

    .card {
      margin-bottom: 10px;
    }
  </style>
</head>

<body>
  <header class="clogin-header">
    <div class="container">
      <nav class="navbar navbar-expand-lg navbar-light">
        <a class="navbar-brand" href="#">
          <img src="assets/img/logo.png">
          <?echo $conf['web_name'] ?>
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
          aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
              <a class="nav-link" href="./">首页</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="user">用户中心</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">开发文档</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="<?echo kfqq($conf['web_kfqq']); ?>" target="_blank">联系我们</a>
            </li>
          </ul>
        </div>
      </nav>
    </div>
  </header>

  <section class="clogin-section clogin-info">
    <div class="container">
      <div class="clogin-section-title text-center">
        <h2>开发文档</h2>
      </div>
      <div class="row">
        <div class="col-md-3">
          <div class="list-group">
            <a href="#doc1" class="list-group-item list-group-item-action">聚合登录介绍</a>
            <a href="#doc2" class="list-group-item list-group-item-action">接口协议规则</a>
            <a href="#doc3" class="list-group-item list-group-item-action">聚合登录流程</a>
            <a href="#doc4" class="list-group-item list-group-item-action">获取用户信息</a>
            <a href="#doc5" class="list-group-item list-group-item-action">SDK下载</a>
          </div>
        </div>
        <div class="col-md-9">

          <div class="card" id="doc1">
            <div class="card-header">
              聚合登录介绍
            </div>
            <div class="card-body">
              <p>
                聚合登录，就是利用用户在第三方平台上已有的账号来快速完成自己应用的登录流程。这里的第三方平台，是指QQ、微信、微博、百度等平台。通过本站的聚合登录接口，你的网站可以登录获取相应的用户信息和授权信息，例如uid、token、用户昵称、头像等。本站的聚合登录完全符合OAuth2.0身份鉴权机制。
              </p>
            </div>
          </div>

          <div class="card" id="doc2">
            <div class="card-header">
              接口协议规则
            </div>
            <div class="card-body">
              <p>传输方式：HTTP</p>
              <p>数据格式：JSON</p>
              <p>字符编码：UTF-8</p>
            </div>
          </div>

          <div class="card" id="doc3">
            <div class="card-header">
              聚合登录流程
            </div>
            <div class="card-body">
              <strong>Step1：获取跳转登录地址</strong><br />
              请求URL：<br />
              <code>
                <?echo $siteurl; ?>connect.php?appid={你的appid}&amp;appkey={你的appkey}&amp;type={登录方式}&amp;act=login&amp;redirect_uri={返回地址}</code><br />
              其中登录方式对应值：<br />
              <table class="table table-hover table-striped table-bordered table-sm">
                <thead>
                  <tr>
                    <th scope="col">对应值</th>
                    <th scope="col">说明</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>qq</td>
                    <td>QQ快捷登录</td>
                  </tr>
                  <tr>
                    <td>wx</td>
                    <td>微信快捷登录(现已支持)</td>
                  </tr>
                  <tr>
                    <td>sina</td>
                    <td>新浪微博快捷登录(暂不支持)</td>
                  </tr>
                  <tr>
                    <td>baidu</td>
                    <td>百度快捷登录(暂不支持)</td>
                  </tr>
                  <tr>
                    <td>alipay</td>
                    <td>支付宝快捷登录(暂不支持)</td>
                  </tr>
                  <tr>
                    <td>oauth</td>
                    <td>使用其他快捷登录系统登陆（套娃）</td>
                  </tr>
                  <tr>
                </tbody>
              </table>
              返回格式：
              <pre>{
  "code": 0,
  "msg": "succ",
  "type": "qq",
  "url": "https://graph.qq.com/oauth2.0/XXXXXXXXXX"
}</pre>
              返回参数说明：
              <table class="table table-hover table-striped table-bordered table-sm" style="table-layout:fixed;">
                <thead>
                  <tr>
                    <th scope="col">参数名</th>
                    <th scope="col">参数类型</th>
                    <th scope="col">参数说明</th>
                    <th scope="col">参数示例</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>code</td>
                    <td>int</td>
                    <td>返回状态码</td>
                    <td>1为成功，其它值为失败</td>
                  </tr>
                  <tr>
                    <td>msg</td>
                    <td>string</td>
                    <td>返回信息</td>
                    <td>返回错误时的说明</td>
                  </tr>
                  <tr>
                    <td>type</td>
                    <td>string</td>
                    <td>登录方式</td>
                    <td>qq</td>
                  </tr>
                  <tr>
                    <td>url</td>
                    <td>string</td>
                    <td>登录跳转地址</td>
                    <td>https://graph.qq.com/oauth2.0/XXXXXXXXXX</td>
                  </tr>
                </tbody>
              </table>

              <br />
              <strong>Step2：跳转到登录地址</strong><br />
              登录地址为上一步返回的url的值。
              <br />
              <br />
              <strong>Step3：登录成功会自动跳转到指定的redirect_uri，并跟上Authorization Code</strong><br />
              例如回调地址是：www.qq.com/my.php，则会跳转到：<br />
              <code>http://www.qq.com/my.php?type=qq&amp;code=520DD95263C1CFEA0870FBB66E******</code>
              <br />
              <br />
              <strong>Step4：通过Authorization Code获取用户信息</strong><br />
              请求URL：
              <code>
                <?echo $siteurl; ?>connect.php?appid={appid}&amp;appkey={appkey}&amp;type={登录方式}&amp;act=callback&amp;code={code}</code><br />
              返回格式：
              <pre>{
  "code": 0,
  "msg": "succ",
  "type": "qq",
  "access_token": "89DC9691E274D6B596FFCB8D43368234",
  "social_uid": "AD3F5033279C8187CBCBB29235D5F827",
  "faceimg": "https://thirdqq.qlogo.cn/g?b=oidb&amp;k=3WrWp3peBxlW4MFxDgDJEQ&amp;s=100&amp;t=1596856919",
  "nickname": "星星不亮了丶",
  "location": "XXXXX市",
  "gender": "男"
}</pre>
              返回参数说明：
              <table class="table table-hover table-striped table-bordered table-sm" style="table-layout:fixed;">
                <thead>
                  <tr>
                    <th scope="col">参数名</th>
                    <th scope="col">参数类型</th>
                    <th scope="col">参数说明</th>
                    <th scope="col">参数示例</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>code</td>
                    <td>int</td>
                    <td>返回状态码</td>
                    <td>1为成功，其它值为失败</td>
                  </tr>
                  <tr>
                    <td>msg</td>
                    <td>string</td>
                    <td>返回信息</td>
                    <td>返回错误时的说明</td>
                  </tr>
                  <tr>
                    <td>type</td>
                    <td>string</td>
                    <td>登录方式</td>
                    <td>qq</td>
                  </tr>
                  <tr>
                    <td>social_uid</td>
                    <td>string</td>
                    <td>第三方登录UID</td>
                    <td>AD3F5033279C8187CBCBB29235D5F827</td>
                  </tr>
                  <tr>
                    <td>access_token</td>
                    <td>string</td>
                    <td>第三方登录token</td>
                    <td>89DC9691E274D6B596FFCB8D43368234</td>
                  </tr>
                  <tr>
                    <td>faceimg</td>
                    <td>string</td>
                    <td>用户头像</td>
                    <td>https://thirdqq.qlogo.cn/g?......</td>
                  </tr>
                  <tr>
                    <td>nickname</td>
                    <td>string</td>
                    <td>用户昵称</td>
                    <td>星星不亮了丶</td>
                  </tr>
                  <tr>
                    <td>gender</td>
                    <td>string</td>
                    <td>用户性别</td>
                    <td>男</td>
                  </tr>
                  <tr>
                    <td>location</td>
                    <td>string</td>
                    <td>用户所在地</td>
                    <td>XXXXX市(仅限支付宝返回)</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>


          <div class="card" id="doc4">
            <div class="card-header">
              获取用户信息接口
            </div>
            <div class="card-body">
              在用户登录后的任意时间，可以请求以下接口再次查询用户的详细信息。<br /><br />
              请求URL：
              <code>
                <?echo $siteurl; ?>connect.php?appid={appid}&amp;appkey={appkey}&amp;type=qq&amp;act=query&amp;social_uid={social_uid}</code><br />
              social_uid就是用户的第三方登录UID，用于识别用户的唯一字段。<br /><br />
              返回格式：
              <pre>{
  "code": 0,
  "msg": "succ",
  "type": "qq",
  "social_uid": "AD3F5033279C8187CBCBB29235D5F827",
  "access_token": "89DC9691E274D6B596FFCB8D43368234",
  "nickname": "星星不亮了丶",
  "faceimg": "https://thirdqq.qlogo.cn/g?b=oidb&amp;k=ianyRGEnPZlMV2aQvvzg2uA&amp;s=100&amp;t=1599703185",
  "location": "XXXXX市",
  "gender": "男",
  "ip": "1.X.X.40"
}</pre>
              返回参数说明：
              <table class="table table-hover table-striped table-bordered table-sm" style="table-layout:fixed;">
                <thead>
                  <tr>
                    <th scope="col">参数名</th>
                    <th scope="col">参数类型</th>
                    <th scope="col">参数说明</th>
                    <th scope="col">参数示例</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>code</td>
                    <td>int</td>
                    <td>返回状态码</td>
                    <td>1为成功，其它值为失败</td>
                  </tr>
                  <tr>
                    <td>msg</td>
                    <td>string</td>
                    <td>返回信息</td>
                    <td>返回错误时的说明</td>
                  </tr>
                  <tr>
                    <td>type</td>
                    <td>string</td>
                    <td>登录方式</td>
                    <td>qq</td>
                  </tr>
                  <tr>
                    <td>social_uid</td>
                    <td>string</td>
                    <td>第三方登录UID</td>
                    <td>AD3F5033279C8187CBCBB29235D5F827</td>
                  </tr>
                  <tr>
                    <td>access_token</td>
                    <td>string</td>
                    <td>第三方登录token</td>
                    <td>89DC9691E274D6B596FFCB8D43368234</td>
                  </tr>
                  <tr>
                    <td>faceimg</td>
                    <td>string</td>
                    <td>用户头像</td>
                    <td>https://thirdqq.qlogo.cn/g?......</td>
                  </tr>
                  <tr>
                    <td>nickname</td>
                    <td>string</td>
                    <td>用户昵称</td>
                    <td>星星不亮了丶</td>
                  </tr>
                  <tr>
                    <td>gender</td>
                    <td>string</td>
                    <td>用户性别</td>
                    <td>男</td>
                  </tr>
                  <tr>
                    <td>location</td>
                    <td>string</td>
                    <td>用户所在地</td>
                    <td>XXXXX市(仅限支付宝返回)</td>
                  </tr>
                  <tr>
                    <td>ip</td>
                    <td>string</td>
                    <td>用户登录IP</td>
                    <td>1.X.X.40</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>

          <div class="card" id="doc5">
            <div class="card-header">
              SDK下载
            </div>
            <div class="card-body">
              <p>SDK版本：1.0</p>
              <p><a href="assets/files/SDK.zip">点击下载</a></p>
            </div>
          </div>

        </div>
      </div>

    </div>
  </section>
  <section class="clogin-section clogin-links">
    <div class="container">
      <?echo htmlspecialchars_decode($conf['web_footer']); ?>
    </div>
  </section>
  <footer class="clogin-footer text-center">
    <p>Copyright © 2020-2021 小发发网络工作室 All Rights Reserved.</p>
    <p><a href="http://beian.miit.gov.cn/" target="_blank" style="color: #999"><img src="assets/img/beian.png" alt="备案">
        <?echo $conf['web_icp']; ?>
      </a></p>
    <p id="time">项目稳定运行了：</p>
  </footer>

  <script src="<?php echo $cdnpublic ?>jquery/3.6.0/jquery.min.js"></script>
  <script src="<?php echo $cdnpublic ?>twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
  <script>
    function timeElapse(time) {
      var current = Date();
      var seconds = (Date.parse(current) - Date.parse(time)) / 1000;
      var days = Math.floor(seconds / (3600 * 24));
      seconds = seconds % (3600 * 24);
      var hours = Math.floor(seconds / 3600);
      if (hours < 10) {
        hours = "0" + hours;
      }
      seconds = seconds % 3600;
      var minutes = Math.floor(seconds / 60);
      if (minutes < 10) {
        minutes = "0" + minutes;
      }
      seconds = seconds % 60;
      if (seconds < 10) {
        seconds = "0" + seconds;
      }
      var result = "项目稳定运行了：" + days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
      $("#time").text(result);
    }
    window.setInterval("timeElapse('<?echo $conf['web_sitetime']; ?>');", 1000);
    //项目运行时间
  </script>
</body>

</html>